package dhm.com.dhmshop.adapter.order;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import dhm.com.dhmshop.R;
import dhm.com.dhmshop.entity.GetOneCategory;
import dhm.com.dhmshop.framework.module.commodity.entity.OneGoodsEntity;

/**
 * Created by admin
 * 2019/4/29
 * 所有订单适配器
 */
public class ParamChildAdapter extends RecyclerView.Adapter<ParamChildAdapter.ViewHolder> {

    private List<String> imageList;
    private List<String> checkList;
    private Context context;


    public ParamChildAdapter(Context context) {
        this.imageList = new ArrayList<>();
        this.context = context;
    }


    public void setImageList(List<String> imageList,List<String> checkList) {
        this.imageList = imageList;
        this.checkList=checkList;
        notifyDataSetChanged();
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        ViewHolder viewHolder;
        View view= LayoutInflater.from(context).inflate(R.layout.item_ordervalue, viewGroup,false);
        viewHolder=new ViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder viewHolder, final int i) {
        viewHolder.fictitious.setText(imageList.get(i));
        viewHolder.fictitious.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onClick.item(i);
            }
        });
    }

    @Override
    public int getItemCount() {
        return imageList.size();
    }

    class ViewHolder extends RecyclerView.ViewHolder {

        public CheckBox fictitious;

        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            fictitious=itemView.findViewById(R.id.fictitious);
        }
    }

    private OnClick onClick;
    public void setdeleteClick(OnClick onClick) {
        this.onClick = onClick;
    }
    public interface OnClick{
        void item(int posttion);
    }

    private OnIntentClick onIntentClick;
    public void setaddClick(OnIntentClick onClick) {
        this.onIntentClick = onClick;
    }
    public interface OnIntentClick{
        void item();
    }



}

